var change = function(src){
	$.post("/islogin.json").done(function(res){
		if(res.code == 0) {
			$("#BODY_FRAME").attr("src", "/" + src);
		} else{
			location.href="login.html";
		}
	}).fail(function(){
		location.reload(true);
	});
};
$(function(){
	var exit = function(){
		layer.confirm('确定要退出？', {
			title : '退出?',
			btn : [ '确定', '取消' ]
		}, function() { 
			$.post("/logout.json", function(res){
				layer.msg('退出成功', {icon : 1});
				setTimeout(function(){location.reload(true);}, 500);
			});
		});
	};
	var resizeWin = function(){
		$("#bodyFrame").height($("#leftFrame").height() - 50);
	};
	var mourceOnli = false;
	var scrollNotice = function() {
		if(mourceOnli == false) {
			$(".header-notice").find("ul").animate({marginTop : "-25px"}, 500, function(){ 
                $(this).css({marginTop : "0px"}).find("li:first").appendTo(this); 
            }); 
		}
    }
	
	$(".layui-body").css("height", $(".layui-side").css("height"));
	$(".layui-body").css("top", "65px");
	$(window).resize(function() {resizeWin();});
	$(".nav-item").on('click', function(){
		$(".layui-disp").removeClass("layui-disp");
	    $(this).addClass('layui-disp');
	});
	$(".header-notice ul li").hover(function(){mourceOnli=true;}, function(){mourceOnli=false;});
	$("#exitButton").on('click', function(){exit();})
	
	layui.use('element', function(){});
	resizeWin();
	setInterval(scrollNotice, 3000);
});